Java 2 Enterprise Edition (“J2EE”) is a specification for building and deploying distributed enterprise applications. Unlike traditional client-server systems, J2EE is based on a multi-tiered architecture in which server side program code is divided into several layers including a “presentation” layer and a “business logic” layer.
FIG. 1 illustrates an exemplary J2EE application server 100 in which the presentation layer is implemented as a Web container 111 and the business layer is implemented as an Enterprise JavaBeans (“EJB”) container 101. Containers are runtime environments which provide standard common services 119, 109 to runtime components. For example, the Java Naming and Directory Interface (“JNDI”) is a service that provides application components with methods for performing standard naming and directory services. Containers also provide unified access to enterprise information systems 117 such as relational databases through the Java Database Connectivity (“JDBC”) service, and legacy computer systems through the J2EE Connector Architecture (“JCA”) service. In addition, containers provide a declarative mechanism for configuring application components at deployment time through the use of deployment descriptors (described in greater detail below).
As illustrated in FIG. 1, each layer of the J2EE architecture includes multiple containers. Web container 111, for example, is itself comprised of a servlet container 115 for processing servlets and a Java Server Pages (“JSP”) container 116 for processing Java server pages. EJB container 101 includes three different containers for supporting three different types of enterprise Java beans: a session bean container 105 for session beans, an entity bean container 106 for entity beans, and a message driven bean container 107 for message driven beans. The EJB specification defines, among other things, aspects of the three types of enterprise Java beans. The EJB specification refers to any of the EJB specifications including, for example, the specification entitled, “Enterprise JavaBeans™ Specification Version 2.1,” (Nov. 12, 2003). A more detailed description of J2EE containers and J2EE services can be found in RAGAE GHALY AND KRISHNA KOTHAPALLI, SAMS TEACH YOURSELF EJB IN 21 DAYS (2003) (see, e.g., pages 353-376).
The information systems of a modem day enterprise (such as a corporation or government institution) are often responsible for managing and performing automated tasks upon large amounts of data. Persistent data is that data that “exists” for extended periods of time (i.e., it “persists”). Persistent data is typically stored in a database so that it can be accessed as needed over the course of its existence. Here, complex database software (e.g., such as DB2, Oracle, and SQL Server) is often used to read the data and perhaps perform various intelligent functions with it. Frequently, persistent data can change over the course of its existence (e.g., by executing a series of reads and writes to the data over the course of its existence). Moreover, multiple items of different persistent data may change as part of a single large scale “distributed transaction.”
FIG. 2 illustrates the manner in which persistent data is managed in current J2EE environments. Session beans 255-257 comprise the high level workflow and business rules implemented by application server 100. For example, in a customer relationship management (“CRM”) system, session beans define the business operations to be performed on the underlying customer data (e.g., calculate average customer invoice dollars, plot the number of customers over a given timeframe, . . . etc.).
Session beans typically execute a single task for a single client during a “session.” Two versions of session beans exist: “stateless” session beans and “stateful” session beans. As its name suggests, a stateless session bean interacts with a client without storing the current state of its interaction with the client. By contrast, a stateful session bean stores its state across multiple client interactions.
Entity beans are persistent objects which represent data (e.g., customers, products, orders, . . . etc.) stored within a database 223. Typically, an entity bean 252 (or 253) is mapped to a table 260 in the relational database and, as indicated in FIG. 2, each “instance” of the entity bean is typically mapped to a row in the table (referred to generally as an “object/relational mapping”). Two different types of persistence may be defined for entity beans: “bean-managed persistence” and “container-managed persistence.” With bean-managed persistence, the entity bean designer must provide the code to access the underlying database (e.g., SQL Java and/or JDBC commands and/or Java Data Objects model). By contrast, with container-managed persistence, the EJB container 101 manages the underlying calls to the database.
The Java Data Objects (JDOs) specification defines a persistence mechanism in which the Java language is used to persist and retrieve data. The JDO specification refers to any of the JDO specifications including, for example, Java Specification Request (JSR)-000012 entitled, “Java Data Objects.” A JDO persistence capable class (or, for ease of reference, a JDO) is an object that can be stored in and retrieved from a persistent data store (e.g., database 223). More specifically, a JDO is a class that implements the javax.jdo.PersistenceCapable interface. Java Data Object (JDO) 254 represents data stored in database 223. Typically, a JDO (e.g., JDO 254) is mapped to a database table (e.g., table 262) and each field of the JDO is mapped to a column of the database.
The term O/R mapping metadata refers to metadata that defines a mapping between an object and a relational database. The O/R mapping metadata for each application is declaratively described and is typically stored in an eXtensible Markup Language (XML) file. These files are commonly called O/R mapping metadata files. The structure of O/R mapping metadata files is not specified by either the EJB specification or the JDO specification. In conventional systems, Container-Managed Persistence (CMP) entity beans and JDOs have separate O/R mapping metadata files. Thus, in conventional systems, an O/R mapping metadata file can map either an entity bean or a JDO to a database, but not both.